// JointPortOwner.cpp: implementation of the JointPortOwner class.
//
//////////////////////////////////////////////////////////////////////

#include "StdAfx.h"
#include "JointPortOwner.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

namespace JointSystem
{

JointPortOwner::JointPortOwner( JointPortOwner* owner ) : Attachable( owner )
{

}

JointPortOwner::~JointPortOwner()
{
	ClearJointPorts();
}

JointPortOwner::JointPortOwner( const JointPortOwner& jpo ) : Attachable( (Attachable&)jpo )
{
	for ( int i = 0; i < jpo.GetJointPortCount(); i++ )
		AddJointPort( new JointPort( *jpo.GetJointPortAt( i ) ) ); 
}

void JointPortOwner::ClearJointPorts()
{
	for ( int i = 0; i < m_JointPorts.GetSize(); i++ )
		delete m_JointPorts.GetAt( i );
	m_JointPorts.RemoveAll();
}

}
